﻿namespace EmbeddedSharp.Core {
    public class DefaultParserFactory : AbstractExpressionParserFactory {

        public override ExpressionParser CreateParser(string expr) {
            ExpressionParser parser = new ExpressionParser(expr)
                                          {
                                              ConstantManager = DefaultDependencyManager.Instance.ConstantManager,
                                              FunctionManager = DefaultDependencyManager.Instance.FunctionManager,
                                              ExpressionParserFactory = this
                                          };

            return parser;
        }

        public override ExpressionParser CreateParser(string expr, object context) {
            return CreateParser(expr);
        }

    }
}
